﻿@using Treca.Quartz.Entity;
@using Treca.Util;
@using EFCore.Sharding; 
@using Treca.Business.Base_SysManage;
@inherits DependencyViewPage 
@using System.Data;
@using Microsoft.AspNetCore.Http;
@using Treca.Base_SysManage.Entity;
@{
    Layout = "~/Views/Shared/_Layout_Form.cshtml";

    var obj = (base_schedulesinfo)Model;
    var objStr = Html.Raw(obj.ToJson());
    Boolean isview = (Boolean)this.ViewData["isview"];
    BaseDataHelper dataHelper = (BaseDataHelper)this.ViewData["listHelper"];
    
}
<div class="fx-wrapper">
      <form class="form-inline" id="searchForm"   style="width: 800px"> 
         <div class="form-group">             
          <!--    <div class="col-sm-2 input-icon-group"  style="width: 60 % "> 
                添加文件
               <div id="WorkerContractImg" style="width:120px;height:104px;overflow:inherit" ></div>
            </div>
            <button type = "button" class="btn btn-info btn-sm" onclick="speech()" );" >
                <i class="glyphicon glyphicon-export" ></i>
                语音输入
            </button>
            <input type = "file1" id="file1" name ="myfile1" style="display: none" />
      
            <button type = "button" class="btn btn-success btn-sm" onclick="OCRForm()" );" >
                <i class="glyphicon glyphicon-export" ></i>
                表单识别
            </button> -->
                <!-- <button id = "submit" type="button" > 提交</button>-->

        </div>
    </form>
</div>
<div style="padding:15px;padding-right:45px;">
    <form id="form" class="form-horizontal" role="form">
        
                          <div class="form-group form-group-sm">
                        <label class="col-sm-2 control-label">@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_JobClass","任务类")</label>
                        <div class="col-sm-5">@{
                                        base_selectresource_data dataselectJobClass = dataHelper.GetDataUrlAll("Quartz", "base_schedulesinfo", "JobClass");
                                        if(!dataselectJobClass.sr.IsNullOrEmpty()&&!dataselectJobClass.sr.Id.IsNullOrEmpty()){
                                             if( dataselectJobClass.bs.selecttype=="1")
                                            {
                                                 <select id="JobClass" name="JobClass" value="@obj.JobClass" class="form-control column selectpicker" data-live-search="true" >
                                                @foreach (DataRow rows in dataselectJobClass.data.Rows)
                                                {
                                                      if((","+@obj.JobClass+",").Contains(","+rows[0].ToString()+","))
                                                      {
                                                         <option value="@rows[0]" selected>@rows[1]</option>
                                                      }
                                                      else
                                                      {
                                                         <option value="@rows[0]">@rows[1]</option>
                                                      }
                                                }
                                                </select>
                                            
                                            }
                                            if( dataselectJobClass.bs.selecttype=="3")
                                            {
                                                <select id="JobClass" name="JobClass" value="@obj.JobClass" class="form-control column selectpicker" data-live-search="true" multiple >
                                                @foreach (DataRow rows in dataselectJobClass.data.Rows)
                                                {
                                                      if((","+@obj.JobClass+",").Contains(","+rows[0].ToString()+","))
                                                      {
                                                         <option value="@rows[0]" selected>@rows[1]</option>
                                                      }
                                                      else
                                                      {
                                                         <option value="@rows[0]">@rows[1]</option>
                                                      }
                                                }
                                                </select>
                                            }
                                             if( dataselectJobClass.bs.selecttype=="2")
                                             {
                                                    List<string> strs=new List<string>();
                                                    var JobClassval="";
                                                    @foreach (DataRow rows in dataselectJobClass.data.Rows)
                                                    {
                                                          if((","+@obj.JobClass+",").Contains(","+rows[0].ToString()+","))
                                                          {
                                                             strs.Add(rows[1].ToString());
                                                             JobClassval=string.Join(",", strs);
                                                          }
                                                    }
                                                string typename = @dataselectJobClass.sr.tablename.Split('.')[@dataselectJobClass.sr.tablename.Split('.').Length - 1];
                                                string areaname = @dataselectJobClass.sr.tablename.Split('.')[@dataselectJobClass.sr.tablename.Split('.').Length - 3];
                                                <input  readonly='readonly' id='JobClass__Name' name='JobClass__Name' value='@JobClassval' onclick='openFormSelect("/@areaname/@typename","@dataselectJobClass.sr.filedcode,@dataselectJobClass.sr.filedvalue",this); ' type='text' class='form-control column'  readonly='readonly'>
                                                <input  readonly='readonly' id='JobClass' name='JobClass' value='@obj.JobClass' type='hidden' class='form-control column'  readonly='readonly'>
                                              }
                                             if( dataselectJobClass.bs.selecttype=="4")
                                             {
                                                 <div id='JobClass__Img' ></div>
                                                 <input id='JobClass__Name' name='JobClass__Name' value='@obj.JobClass' type='hidden'  class='form-control column'  readonly='readonly'/>
                                                 <input id='JobClass' name='JobClass' value='@obj.JobClass'  type='hidden' class='form-control column'  readonly='readonly'/>
                                                  @Html.Raw("<script>\n");
                                                  @Html.Raw("$(function(){\n");
                                                  @Html.Raw("$('#JobClass__Img').html5Uploader({\n");
                                                  @Html.Raw("asyncUpload: true,\n");
                                                  @Html.Raw("uploadUrl: '/Base_SysManage/Common/UploadFile',\n");
                                                  @Html.Raw("uploadLimit: 0,  //上传数量限制，0为不限\n");
                                                  @Html.Raw("sizeLimit: 5,    //大小限制，M\n");
                                                  @Html.Raw("type: 'file' //file即可上传文件也可上传图片\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("$('#JobClass__Name').trigger('propertychange');});\n");
                                                  @Html.Raw("$('#JobClass__Name').on(' input propertychange',function(){\n");
                                                  @Html.Raw("var urls = $(this).val().split(',');\n");
                                                  @Html.Raw("var ids = $('#JobClass').val().split(',');\n");
                                                  @Html.Raw("$.each(urls, function(index, url){\n");
                                                  @Html.Raw("if(url!='')\n");
                                                  @Html.Raw("$('#JobClass__Img').html5Uploader('insertItemNew',{src:url,id:ids[index]});\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("</script>\n");
                                            }
                                            }
                                        else {
                                        <input id="JobClass" name="JobClass"  maxlength="50" value="@obj.JobClass" type="text" class="form-control column" >}}
                                </div>
                            </div>
                          <div class="form-group form-group-sm">
                        <label class="col-sm-2 control-label">@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_JobGroup","任务组")</label>
                        <div class="col-sm-5">@{
                                        base_selectresource_data dataselectJobGroup = dataHelper.GetDataUrlAll("Quartz", "base_schedulesinfo", "JobGroup");
                                        if(!dataselectJobGroup.sr.IsNullOrEmpty()&&!dataselectJobGroup.sr.Id.IsNullOrEmpty()){
                                             if( dataselectJobGroup.bs.selecttype=="1")
                                            {
                                                 <select id="JobGroup" name="JobGroup" value="@obj.JobGroup" class="form-control column selectpicker" data-live-search="true" >
                                                @foreach (DataRow rows in dataselectJobGroup.data.Rows)
                                                {
                                                      if((","+@obj.JobGroup+",").Contains(","+rows[0].ToString()+","))
                                                      {
                                                         <option value="@rows[0]" selected>@rows[1]</option>
                                                      }
                                                      else
                                                      {
                                                         <option value="@rows[0]">@rows[1]</option>
                                                      }
                                                }
                                                </select>
                                            
                                            }
                                            if( dataselectJobGroup.bs.selecttype=="3")
                                            {
                                                <select id="JobGroup" name="JobGroup" value="@obj.JobGroup" class="form-control column selectpicker" data-live-search="true" multiple >
                                                @foreach (DataRow rows in dataselectJobGroup.data.Rows)
                                                {
                                                      if((","+@obj.JobGroup+",").Contains(","+rows[0].ToString()+","))
                                                      {
                                                         <option value="@rows[0]" selected>@rows[1]</option>
                                                      }
                                                      else
                                                      {
                                                         <option value="@rows[0]">@rows[1]</option>
                                                      }
                                                }
                                                </select>
                                            }
                                             if( dataselectJobGroup.bs.selecttype=="2")
                                             {
                                                    List<string> strs=new List<string>();
                                                    var JobGroupval="";
                                                    @foreach (DataRow rows in dataselectJobGroup.data.Rows)
                                                    {
                                                          if((","+@obj.JobGroup+",").Contains(","+rows[0].ToString()+","))
                                                          {
                                                             strs.Add(rows[1].ToString());
                                                             JobGroupval=string.Join(",", strs);
                                                          }
                                                    }
                                                string typename = @dataselectJobGroup.sr.tablename.Split('.')[@dataselectJobGroup.sr.tablename.Split('.').Length - 1];
                                                string areaname = @dataselectJobGroup.sr.tablename.Split('.')[@dataselectJobGroup.sr.tablename.Split('.').Length - 3];
                                                <input  readonly='readonly' id='JobGroup__Name' name='JobGroup__Name' value='@JobGroupval' onclick='openFormSelect("/@areaname/@typename","@dataselectJobGroup.sr.filedcode,@dataselectJobGroup.sr.filedvalue",this); ' type='text' class='form-control column'  readonly='readonly'>
                                                <input  readonly='readonly' id='JobGroup' name='JobGroup' value='@obj.JobGroup' type='hidden' class='form-control column'  readonly='readonly'>
                                              }
                                             if( dataselectJobGroup.bs.selecttype=="4")
                                             {
                                                 <div id='JobGroup__Img' ></div>
                                                 <input id='JobGroup__Name' name='JobGroup__Name' value='@obj.JobGroup' type='hidden'  class='form-control column'  readonly='readonly'/>
                                                 <input id='JobGroup' name='JobGroup' value='@obj.JobGroup'  type='hidden' class='form-control column'  readonly='readonly'/>
                                                  @Html.Raw("<script>\n");
                                                  @Html.Raw("$(function(){\n");
                                                  @Html.Raw("$('#JobGroup__Img').html5Uploader({\n");
                                                  @Html.Raw("asyncUpload: true,\n");
                                                  @Html.Raw("uploadUrl: '/Base_SysManage/Common/UploadFile',\n");
                                                  @Html.Raw("uploadLimit: 0,  //上传数量限制，0为不限\n");
                                                  @Html.Raw("sizeLimit: 5,    //大小限制，M\n");
                                                  @Html.Raw("type: 'file' //file即可上传文件也可上传图片\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("$('#JobGroup__Name').trigger('propertychange');});\n");
                                                  @Html.Raw("$('#JobGroup__Name').on(' input propertychange',function(){\n");
                                                  @Html.Raw("var urls = $(this).val().split(',');\n");
                                                  @Html.Raw("var ids = $('#JobGroup').val().split(',');\n");
                                                  @Html.Raw("$.each(urls, function(index, url){\n");
                                                  @Html.Raw("if(url!='')\n");
                                                  @Html.Raw("$('#JobGroup__Img').html5Uploader('insertItemNew',{src:url,id:ids[index]});\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("</script>\n");
                                            }
                                            }
                                        else {
                                        <input id="JobGroup" name="JobGroup"  maxlength="50" value="@obj.JobGroup" type="text" class="form-control column" >}}
                                </div>
                            </div>
                          <div class="form-group form-group-sm">
                        <label class="col-sm-2 control-label">@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_JobName","任务名")</label>
                        <div class="col-sm-5">@{
                                        base_selectresource_data dataselectJobName = dataHelper.GetDataUrlAll("Quartz", "base_schedulesinfo", "JobName");
                                        if(!dataselectJobName.sr.IsNullOrEmpty()&&!dataselectJobName.sr.Id.IsNullOrEmpty()){
                                             if( dataselectJobName.bs.selecttype=="1")
                                            {
                                                 <select id="JobName" name="JobName" value="@obj.JobName" class="form-control column selectpicker" data-live-search="true" >
                                                @foreach (DataRow rows in dataselectJobName.data.Rows)
                                                {
                                                      if((","+@obj.JobName+",").Contains(","+rows[0].ToString()+","))
                                                      {
                                                         <option value="@rows[0]" selected>@rows[1]</option>
                                                      }
                                                      else
                                                      {
                                                         <option value="@rows[0]">@rows[1]</option>
                                                      }
                                                }
                                                </select>
                                            
                                            }
                                            if( dataselectJobName.bs.selecttype=="3")
                                            {
                                                <select id="JobName" name="JobName" value="@obj.JobName" class="form-control column selectpicker" data-live-search="true" multiple >
                                                @foreach (DataRow rows in dataselectJobName.data.Rows)
                                                {
                                                      if((","+@obj.JobName+",").Contains(","+rows[0].ToString()+","))
                                                      {
                                                         <option value="@rows[0]" selected>@rows[1]</option>
                                                      }
                                                      else
                                                      {
                                                         <option value="@rows[0]">@rows[1]</option>
                                                      }
                                                }
                                                </select>
                                            }
                                             if( dataselectJobName.bs.selecttype=="2")
                                             {
                                                    List<string> strs=new List<string>();
                                                    var JobNameval="";
                                                    @foreach (DataRow rows in dataselectJobName.data.Rows)
                                                    {
                                                          if((","+@obj.JobName+",").Contains(","+rows[0].ToString()+","))
                                                          {
                                                             strs.Add(rows[1].ToString());
                                                             JobNameval=string.Join(",", strs);
                                                          }
                                                    }
                                                string typename = @dataselectJobName.sr.tablename.Split('.')[@dataselectJobName.sr.tablename.Split('.').Length - 1];
                                                string areaname = @dataselectJobName.sr.tablename.Split('.')[@dataselectJobName.sr.tablename.Split('.').Length - 3];
                                                <input  readonly='readonly' id='JobName__Name' name='JobName__Name' value='@JobNameval' onclick='openFormSelect("/@areaname/@typename","@dataselectJobName.sr.filedcode,@dataselectJobName.sr.filedvalue",this); ' type='text' class='form-control column'  readonly='readonly'>
                                                <input  readonly='readonly' id='JobName' name='JobName' value='@obj.JobName' type='hidden' class='form-control column'  readonly='readonly'>
                                              }
                                             if( dataselectJobName.bs.selecttype=="4")
                                             {
                                                 <div id='JobName__Img' ></div>
                                                 <input id='JobName__Name' name='JobName__Name' value='@obj.JobName' type='hidden'  class='form-control column'  readonly='readonly'/>
                                                 <input id='JobName' name='JobName' value='@obj.JobName'  type='hidden' class='form-control column'  readonly='readonly'/>
                                                  @Html.Raw("<script>\n");
                                                  @Html.Raw("$(function(){\n");
                                                  @Html.Raw("$('#JobName__Img').html5Uploader({\n");
                                                  @Html.Raw("asyncUpload: true,\n");
                                                  @Html.Raw("uploadUrl: '/Base_SysManage/Common/UploadFile',\n");
                                                  @Html.Raw("uploadLimit: 0,  //上传数量限制，0为不限\n");
                                                  @Html.Raw("sizeLimit: 5,    //大小限制，M\n");
                                                  @Html.Raw("type: 'file' //file即可上传文件也可上传图片\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("$('#JobName__Name').trigger('propertychange');});\n");
                                                  @Html.Raw("$('#JobName__Name').on(' input propertychange',function(){\n");
                                                  @Html.Raw("var urls = $(this).val().split(',');\n");
                                                  @Html.Raw("var ids = $('#JobName').val().split(',');\n");
                                                  @Html.Raw("$.each(urls, function(index, url){\n");
                                                  @Html.Raw("if(url!='')\n");
                                                  @Html.Raw("$('#JobName__Img').html5Uploader('insertItemNew',{src:url,id:ids[index]});\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("</script>\n");
                                            }
                                            }
                                        else {
                                        <input id="JobName" name="JobName"  maxlength="50" value="@obj.JobName" type="text" class="form-control column" >}}
                                </div>
                            </div>
                          <div class="form-group form-group-sm">
                        <label class="col-sm-2 control-label">@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_JobDesc","任务描述")</label>
                        <div class="col-sm-5">@{
                                        base_selectresource_data dataselectJobDesc = dataHelper.GetDataUrlAll("Quartz", "base_schedulesinfo", "JobDesc");
                                        if(!dataselectJobDesc.sr.IsNullOrEmpty()&&!dataselectJobDesc.sr.Id.IsNullOrEmpty()){
                                             if( dataselectJobDesc.bs.selecttype=="1")
                                            {
                                                 <select id="JobDesc" name="JobDesc" value="@obj.JobDesc" class="form-control column selectpicker" data-live-search="true" >
                                                @foreach (DataRow rows in dataselectJobDesc.data.Rows)
                                                {
                                                      if((","+@obj.JobDesc+",").Contains(","+rows[0].ToString()+","))
                                                      {
                                                         <option value="@rows[0]" selected>@rows[1]</option>
                                                      }
                                                      else
                                                      {
                                                         <option value="@rows[0]">@rows[1]</option>
                                                      }
                                                }
                                                </select>
                                            
                                            }
                                            if( dataselectJobDesc.bs.selecttype=="3")
                                            {
                                                <select id="JobDesc" name="JobDesc" value="@obj.JobDesc" class="form-control column selectpicker" data-live-search="true" multiple >
                                                @foreach (DataRow rows in dataselectJobDesc.data.Rows)
                                                {
                                                      if((","+@obj.JobDesc+",").Contains(","+rows[0].ToString()+","))
                                                      {
                                                         <option value="@rows[0]" selected>@rows[1]</option>
                                                      }
                                                      else
                                                      {
                                                         <option value="@rows[0]">@rows[1]</option>
                                                      }
                                                }
                                                </select>
                                            }
                                             if( dataselectJobDesc.bs.selecttype=="2")
                                             {
                                                    List<string> strs=new List<string>();
                                                    var JobDescval="";
                                                    @foreach (DataRow rows in dataselectJobDesc.data.Rows)
                                                    {
                                                          if((","+@obj.JobDesc+",").Contains(","+rows[0].ToString()+","))
                                                          {
                                                             strs.Add(rows[1].ToString());
                                                             JobDescval=string.Join(",", strs);
                                                          }
                                                    }
                                                string typename = @dataselectJobDesc.sr.tablename.Split('.')[@dataselectJobDesc.sr.tablename.Split('.').Length - 1];
                                                string areaname = @dataselectJobDesc.sr.tablename.Split('.')[@dataselectJobDesc.sr.tablename.Split('.').Length - 3];
                                                <input  readonly='readonly' id='JobDesc__Name' name='JobDesc__Name' value='@JobDescval' onclick='openFormSelect("/@areaname/@typename","@dataselectJobDesc.sr.filedcode,@dataselectJobDesc.sr.filedvalue",this); ' type='text' class='form-control column'  readonly='readonly'>
                                                <input  readonly='readonly' id='JobDesc' name='JobDesc' value='@obj.JobDesc' type='hidden' class='form-control column'  readonly='readonly'>
                                              }
                                             if( dataselectJobDesc.bs.selecttype=="4")
                                             {
                                                 <div id='JobDesc__Img' ></div>
                                                 <input id='JobDesc__Name' name='JobDesc__Name' value='@obj.JobDesc' type='hidden'  class='form-control column'  readonly='readonly'/>
                                                 <input id='JobDesc' name='JobDesc' value='@obj.JobDesc'  type='hidden' class='form-control column'  readonly='readonly'/>
                                                  @Html.Raw("<script>\n");
                                                  @Html.Raw("$(function(){\n");
                                                  @Html.Raw("$('#JobDesc__Img').html5Uploader({\n");
                                                  @Html.Raw("asyncUpload: true,\n");
                                                  @Html.Raw("uploadUrl: '/Base_SysManage/Common/UploadFile',\n");
                                                  @Html.Raw("uploadLimit: 0,  //上传数量限制，0为不限\n");
                                                  @Html.Raw("sizeLimit: 5,    //大小限制，M\n");
                                                  @Html.Raw("type: 'file' //file即可上传文件也可上传图片\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("$('#JobDesc__Name').trigger('propertychange');});\n");
                                                  @Html.Raw("$('#JobDesc__Name').on(' input propertychange',function(){\n");
                                                  @Html.Raw("var urls = $(this).val().split(',');\n");
                                                  @Html.Raw("var ids = $('#JobDesc').val().split(',');\n");
                                                  @Html.Raw("$.each(urls, function(index, url){\n");
                                                  @Html.Raw("if(url!='')\n");
                                                  @Html.Raw("$('#JobDesc__Img').html5Uploader('insertItemNew',{src:url,id:ids[index]});\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("</script>\n");
                                            }
                                            }
                                        else {
                                        <input id="JobDesc" name="JobDesc"  maxlength="100" value="@obj.JobDesc" type="text" class="form-control column" >}}
                                </div>
                            </div>
                          <div class="form-group form-group-sm">
                        <label class="col-sm-2 control-label">@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_RunStatus","运行状态")</label>
                        <div class="col-sm-5">@{
                                        base_selectresource_data dataselectRunStatus = dataHelper.GetDataUrlAll("Quartz", "base_schedulesinfo", "RunStatus");
                                        if(!dataselectRunStatus.sr.IsNullOrEmpty()&&!dataselectRunStatus.sr.Id.IsNullOrEmpty()){
                                             if( dataselectRunStatus.bs.selecttype=="1")
                                            {
                                                 <select id="RunStatus" name="RunStatus" value="@obj.RunStatus" class="form-control column selectpicker" data-live-search="true" >
                                                @foreach (DataRow rows in dataselectRunStatus.data.Rows)
                                                {
                                                      if((","+@obj.RunStatus+",").Contains(","+rows[0].ToString()+","))
                                                      {
                                                         <option value="@rows[0]" selected>@rows[1]</option>
                                                      }
                                                      else
                                                      {
                                                         <option value="@rows[0]">@rows[1]</option>
                                                      }
                                                }
                                                </select>
                                            
                                            }
                                            if( dataselectRunStatus.bs.selecttype=="3")
                                            {
                                                <select id="RunStatus" name="RunStatus" value="@obj.RunStatus" class="form-control column selectpicker" data-live-search="true" multiple >
                                                @foreach (DataRow rows in dataselectRunStatus.data.Rows)
                                                {
                                                      if((","+@obj.RunStatus+",").Contains(","+rows[0].ToString()+","))
                                                      {
                                                         <option value="@rows[0]" selected>@rows[1]</option>
                                                      }
                                                      else
                                                      {
                                                         <option value="@rows[0]">@rows[1]</option>
                                                      }
                                                }
                                                </select>
                                            }
                                             if( dataselectRunStatus.bs.selecttype=="2")
                                             {
                                                    List<string> strs=new List<string>();
                                                    var RunStatusval="";
                                                    @foreach (DataRow rows in dataselectRunStatus.data.Rows)
                                                    {
                                                          if((","+@obj.RunStatus+",").Contains(","+rows[0].ToString()+","))
                                                          {
                                                             strs.Add(rows[1].ToString());
                                                             RunStatusval=string.Join(",", strs);
                                                          }
                                                    }
                                                string typename = @dataselectRunStatus.sr.tablename.Split('.')[@dataselectRunStatus.sr.tablename.Split('.').Length - 1];
                                                string areaname = @dataselectRunStatus.sr.tablename.Split('.')[@dataselectRunStatus.sr.tablename.Split('.').Length - 3];
                                                <input  readonly='readonly' id='RunStatus__Name' name='RunStatus__Name' value='@RunStatusval' onclick='openFormSelect("/@areaname/@typename","@dataselectRunStatus.sr.filedcode,@dataselectRunStatus.sr.filedvalue",this); ' type='text' class='form-control column'  readonly='readonly'>
                                                <input  readonly='readonly' id='RunStatus' name='RunStatus' value='@obj.RunStatus' type='hidden' class='form-control column'  readonly='readonly'>
                                              }
                                             if( dataselectRunStatus.bs.selecttype=="4")
                                             {
                                                 <div id='RunStatus__Img' ></div>
                                                 <input id='RunStatus__Name' name='RunStatus__Name' value='@obj.RunStatus' type='hidden'  class='form-control column'  readonly='readonly'/>
                                                 <input id='RunStatus' name='RunStatus' value='@obj.RunStatus'  type='hidden' class='form-control column'  readonly='readonly'/>
                                                  @Html.Raw("<script>\n");
                                                  @Html.Raw("$(function(){\n");
                                                  @Html.Raw("$('#RunStatus__Img').html5Uploader({\n");
                                                  @Html.Raw("asyncUpload: true,\n");
                                                  @Html.Raw("uploadUrl: '/Base_SysManage/Common/UploadFile',\n");
                                                  @Html.Raw("uploadLimit: 0,  //上传数量限制，0为不限\n");
                                                  @Html.Raw("sizeLimit: 5,    //大小限制，M\n");
                                                  @Html.Raw("type: 'file' //file即可上传文件也可上传图片\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("$('#RunStatus__Name').trigger('propertychange');});\n");
                                                  @Html.Raw("$('#RunStatus__Name').on(' input propertychange',function(){\n");
                                                  @Html.Raw("var urls = $(this).val().split(',');\n");
                                                  @Html.Raw("var ids = $('#RunStatus').val().split(',');\n");
                                                  @Html.Raw("$.each(urls, function(index, url){\n");
                                                  @Html.Raw("if(url!='')\n");
                                                  @Html.Raw("$('#RunStatus__Img').html5Uploader('insertItemNew',{src:url,id:ids[index]});\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("</script>\n");
                                            }
                                            }
                                        else {
                                        <input id="RunStatus" name="RunStatus"  maxlength="50" value="@obj.RunStatus" type="text" class="form-control column" >}}
                                </div>
                            </div>
                          <div class="form-group form-group-sm">
                        <label class="col-sm-2 control-label">@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_CromExpress","Cron表达式")</label>
                        <div class="col-sm-5">@{
                                        base_selectresource_data dataselectCromExpress = dataHelper.GetDataUrlAll("Quartz", "base_schedulesinfo", "CromExpress");
                                        if(!dataselectCromExpress.sr.IsNullOrEmpty()&&!dataselectCromExpress.sr.Id.IsNullOrEmpty()){
                                             if( dataselectCromExpress.bs.selecttype=="1")
                                            {
                                                 <select id="CromExpress" name="CromExpress" value="@obj.CromExpress" class="form-control column selectpicker" data-live-search="true" >
                                                @foreach (DataRow rows in dataselectCromExpress.data.Rows)
                                                {
                                                      if((","+@obj.CromExpress+",").Contains(","+rows[0].ToString()+","))
                                                      {
                                                         <option value="@rows[0]" selected>@rows[1]</option>
                                                      }
                                                      else
                                                      {
                                                         <option value="@rows[0]">@rows[1]</option>
                                                      }
                                                }
                                                </select>
                                            
                                            }
                                            if( dataselectCromExpress.bs.selecttype=="3")
                                            {
                                                <select id="CromExpress" name="CromExpress" value="@obj.CromExpress" class="form-control column selectpicker" data-live-search="true" multiple >
                                                @foreach (DataRow rows in dataselectCromExpress.data.Rows)
                                                {
                                                      if((","+@obj.CromExpress+",").Contains(","+rows[0].ToString()+","))
                                                      {
                                                         <option value="@rows[0]" selected>@rows[1]</option>
                                                      }
                                                      else
                                                      {
                                                         <option value="@rows[0]">@rows[1]</option>
                                                      }
                                                }
                                                </select>
                                            }
                                             if( dataselectCromExpress.bs.selecttype=="2")
                                             {
                                                    List<string> strs=new List<string>();
                                                    var CromExpressval="";
                                                    @foreach (DataRow rows in dataselectCromExpress.data.Rows)
                                                    {
                                                          if((","+@obj.CromExpress+",").Contains(","+rows[0].ToString()+","))
                                                          {
                                                             strs.Add(rows[1].ToString());
                                                             CromExpressval=string.Join(",", strs);
                                                          }
                                                    }
                                                string typename = @dataselectCromExpress.sr.tablename.Split('.')[@dataselectCromExpress.sr.tablename.Split('.').Length - 1];
                                                string areaname = @dataselectCromExpress.sr.tablename.Split('.')[@dataselectCromExpress.sr.tablename.Split('.').Length - 3];
                                                <input  readonly='readonly' id='CromExpress__Name' name='CromExpress__Name' value='@CromExpressval' onclick='openFormSelect("/@areaname/@typename","@dataselectCromExpress.sr.filedcode,@dataselectCromExpress.sr.filedvalue",this); ' type='text' class='form-control column'  readonly='readonly'>
                                                <input  readonly='readonly' id='CromExpress' name='CromExpress' value='@obj.CromExpress' type='hidden' class='form-control column'  readonly='readonly'>
                                              }
                                             if( dataselectCromExpress.bs.selecttype=="4")
                                             {
                                                 <div id='CromExpress__Img' ></div>
                                                 <input id='CromExpress__Name' name='CromExpress__Name' value='@obj.CromExpress' type='hidden'  class='form-control column'  readonly='readonly'/>
                                                 <input id='CromExpress' name='CromExpress' value='@obj.CromExpress'  type='hidden' class='form-control column'  readonly='readonly'/>
                                                  @Html.Raw("<script>\n");
                                                  @Html.Raw("$(function(){\n");
                                                  @Html.Raw("$('#CromExpress__Img').html5Uploader({\n");
                                                  @Html.Raw("asyncUpload: true,\n");
                                                  @Html.Raw("uploadUrl: '/Base_SysManage/Common/UploadFile',\n");
                                                  @Html.Raw("uploadLimit: 0,  //上传数量限制，0为不限\n");
                                                  @Html.Raw("sizeLimit: 5,    //大小限制，M\n");
                                                  @Html.Raw("type: 'file' //file即可上传文件也可上传图片\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("$('#CromExpress__Name').trigger('propertychange');});\n");
                                                  @Html.Raw("$('#CromExpress__Name').on(' input propertychange',function(){\n");
                                                  @Html.Raw("var urls = $(this).val().split(',');\n");
                                                  @Html.Raw("var ids = $('#CromExpress').val().split(',');\n");
                                                  @Html.Raw("$.each(urls, function(index, url){\n");
                                                  @Html.Raw("if(url!='')\n");
                                                  @Html.Raw("$('#CromExpress__Img').html5Uploader('insertItemNew',{src:url,id:ids[index]});\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("</script>\n");
                                            }
                                            }
                                        else {
                                        <input id="CromExpress" name="CromExpress"  maxlength="50" value="@obj.CromExpress" type="text" class="form-control column" >}}
                                </div>
                            </div>
                        <div class="form-group form-group-sm">
                            <label class="col-sm-2 control-label">@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_StarRunTime","开始运行时间")</label>
                            <div class="col-sm-5">
                                <input readonly='readonly' id="StarRunTime" name="StarRunTime" data-date-format="yyyy-MM-dd HH:mm:ss" maxlength="1000" value="@obj.StarRunTime?.ToString("yyyy-MM-dd HH:mm:ss")" type="text" class="form-control column" >
                                <div class="help-block with-errors"></div>
                            </div>
                             <script>
                                $('#StarRunTime').datetimepicker({
                                //language: 'zh-CN',
                                //format:'yyyy-mm-dd hh:ii:ss',
                                //minView: 0,//日期选择
                                //autoclose:true
                                    minView: 'day', //选择日期后，不会再跳转去选择时分秒 
                                    language: 'zh-CN',
                                    format: 'yyyy-mm-dd hh:ii:ss',
                                    todayBtn: 1,
                                    autoclose: 1
                                });
                        </script>
                        </div>
                        <div class="form-group form-group-sm">
                            <label class="col-sm-2 control-label">@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_EndRunTime","结束运行时间")</label>
                            <div class="col-sm-5">
                                <input readonly='readonly' id="EndRunTime" name="EndRunTime" data-date-format="yyyy-MM-dd HH:mm:ss" maxlength="1000" value="@obj.EndRunTime?.ToString("yyyy-MM-dd HH:mm:ss")" type="text" class="form-control column" >
                                <div class="help-block with-errors"></div>
                            </div>
                             <script>
                                $('#EndRunTime').datetimepicker({
                                    //language: 'zh-CN',
                                    //format:'yyyy-mm-dd hh:ii:ss',
                                    //minView: 0,//日期选择
                                    //autoclose:true
                                    minView: 'day', //选择日期后，不会再跳转去选择时分秒 
                                    language: 'zh-CN',
                                    format: 'yyyy-mm-dd hh:ii:ss',
                                    todayBtn: 1,
                                    autoclose: 1
                                });
                        </script>
                        </div>
                        <div class="form-group form-group-sm">
                            <label class="col-sm-2 control-label">@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_PreviousRunTime","上次运行时间")</label>
                            <div class="col-sm-5">
                                <input readonly='readonly' id="PreviousRunTime" name="PreviousRunTime" data-date-format="yyyy-MM-dd HH:mm:ss" maxlength="1000" value="@obj.PreviousRunTime?.ToString("yyyy-MM-dd HH:mm:ss")" type="text" class="form-control column" >
                                <div class="help-block with-errors"></div>
                            </div>
                             <script>
                                $('#PreviousRunTime').datetimepicker({
                                //language: 'zh-CN',
                                //format:'yyyy-mm-dd hh:ii:ss',
                                //minView: 0,//日期选择
                                //autoclose:true
                                    minView: 'day', //选择日期后，不会再跳转去选择时分秒 
                                    language: 'zh-CN',
                                    format: 'yyyy-mm-dd hh:ii:ss',
                                    todayBtn: 1,
                                    autoclose: 1
                                });
                        </script>
                        </div>
                        <div class="form-group form-group-sm">
                            <label class="col-sm-2 control-label">@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_NextRunTime","下次运行时间")</label>
                            <div class="col-sm-5">
                                <input readonly='readonly' id="NextRunTime" name="NextRunTime" data-date-format="yyyy-MM-dd HH:mm:ss" maxlength="1000" value="@obj.NextRunTime?.ToString("yyyy-MM-dd HH:mm:ss")" type="text" class="form-control column" >
                                <div class="help-block with-errors"></div>
                            </div>
                             <script>
                                $('#NextRunTime').datetimepicker({
                                //language: 'zh-CN',
                                //format:'yyyy-mm-dd hh:ii:ss',
                                //minView: 0,//日期选择
                                //autoclose:true
                                    minView: 'month', //选择日期后，不会再跳转去选择时分秒 
                                    language: 'zh-CN',
                                    format: 'yyyy-mm-dd',
                                    todayBtn: 1,
                                    autoclose: 1
                                });
                        </script>
                        </div>
                          <div class="form-group form-group-sm">
                        <label class="col-sm-2 control-label">@TranslateService.GetTranslate("","Quartz_base_schedulesinfo_Remark","备注")</label>
                        <div class="col-sm-5">@{
                                        base_selectresource_data dataselectRemark = dataHelper.GetDataUrlAll("Quartz", "base_schedulesinfo", "Remark");
                                        if(!dataselectRemark.sr.IsNullOrEmpty()&&!dataselectRemark.sr.Id.IsNullOrEmpty()){
                                             if( dataselectRemark.bs.selecttype=="1")
                                            {
                                                 <select id="Remark" name="Remark" value="@obj.Remark" class="form-control column selectpicker" data-live-search="true" >
                                                @foreach (DataRow rows in dataselectRemark.data.Rows)
                                                {
                                                      if((","+@obj.Remark+",").Contains(","+rows[0].ToString()+","))
                                                      {
                                                         <option value="@rows[0]" selected>@rows[1]</option>
                                                      }
                                                      else
                                                      {
                                                         <option value="@rows[0]">@rows[1]</option>
                                                      }
                                                }
                                                </select>
                                            
                                            }
                                            if( dataselectRemark.bs.selecttype=="3")
                                            {
                                                <select id="Remark" name="Remark" value="@obj.Remark" class="form-control column selectpicker" data-live-search="true" multiple >
                                                @foreach (DataRow rows in dataselectRemark.data.Rows)
                                                {
                                                      if((","+@obj.Remark+",").Contains(","+rows[0].ToString()+","))
                                                      {
                                                         <option value="@rows[0]" selected>@rows[1]</option>
                                                      }
                                                      else
                                                      {
                                                         <option value="@rows[0]">@rows[1]</option>
                                                      }
                                                }
                                                </select>
                                            }
                                             if( dataselectRemark.bs.selecttype=="2")
                                             {
                                                    List<string> strs=new List<string>();
                                                    var Remarkval="";
                                                    @foreach (DataRow rows in dataselectRemark.data.Rows)
                                                    {
                                                          if((","+@obj.Remark+",").Contains(","+rows[0].ToString()+","))
                                                          {
                                                             strs.Add(rows[1].ToString());
                                                             Remarkval=string.Join(",", strs);
                                                          }
                                                    }
                                                string typename = @dataselectRemark.sr.tablename.Split('.')[@dataselectRemark.sr.tablename.Split('.').Length - 1];
                                                string areaname = @dataselectRemark.sr.tablename.Split('.')[@dataselectRemark.sr.tablename.Split('.').Length - 3];
                                                <input  readonly='readonly' id='Remark__Name' name='Remark__Name' value='@Remarkval' onclick='openFormSelect("/@areaname/@typename","@dataselectRemark.sr.filedcode,@dataselectRemark.sr.filedvalue",this); ' type='text' class='form-control column'  readonly='readonly'>
                                                <input  readonly='readonly' id='Remark' name='Remark' value='@obj.Remark' type='hidden' class='form-control column'  readonly='readonly'>
                                              }
                                             if( dataselectRemark.bs.selecttype=="4")
                                             {
                                                 <div id='Remark__Img' ></div>
                                                 <input id='Remark__Name' name='Remark__Name' value='@obj.Remark' type='hidden'  class='form-control column'  readonly='readonly'/>
                                                 <input id='Remark' name='Remark' value='@obj.Remark'  type='hidden' class='form-control column'  readonly='readonly'/>
                                                  @Html.Raw("<script>\n");
                                                  @Html.Raw("$(function(){\n");
                                                  @Html.Raw("$('#Remark__Img').html5Uploader({\n");
                                                  @Html.Raw("asyncUpload: true,\n");
                                                  @Html.Raw("uploadUrl: '/Base_SysManage/Common/UploadFile',\n");
                                                  @Html.Raw("uploadLimit: 0,  //上传数量限制，0为不限\n");
                                                  @Html.Raw("sizeLimit: 5,    //大小限制，M\n");
                                                  @Html.Raw("type: 'file' //file即可上传文件也可上传图片\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("$('#Remark__Name').trigger('propertychange');});\n");
                                                  @Html.Raw("$('#Remark__Name').on(' input propertychange',function(){\n");
                                                  @Html.Raw("var urls = $(this).val().split(',');\n");
                                                  @Html.Raw("var ids = $('#Remark').val().split(',');\n");
                                                  @Html.Raw("$.each(urls, function(index, url){\n");
                                                  @Html.Raw("if(url!='')\n");
                                                  @Html.Raw("$('#Remark__Img').html5Uploader('insertItemNew',{src:url,id:ids[index]});\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("});\n");
                                                  @Html.Raw("</script>\n");
                                            }
                                            }
                                        else {
                                        <input id="Remark" name="Remark"  maxlength="200" value="@obj.Remark" type="text" class="form-control column" >}}
                                </div>
                            </div>
        <!-- tab标签 -->
        <ul id='myTab' class='nav nav-tabs'>
            
        </ul>
        <div id='myTabContent' class='tab-content'>
            
        </div>
        <div class="form-group">
            <button id="submit" type="submit" class="hidden">@TranslateService.GetTranslate("","System_Submit","提交")</button>
        </div>
    </form>
</div>
<script>

    var isview=@isview.ToString().ToLower();
    var theEntity = @objStr;
    
    $(function () {
        initEvent();
        if(isview)
        {
            $(".column").attr("disabled",true);
        }
    });

    //事件绑定
    function initEvent() {
        //表单校验
        $('#form').validator().on('submit', function (e) {
            //校验成功
            if (!e.isDefaultPrevented()) {
                e.preventDefault();

                var values = $('#form').getValues();
                
                $.extend(theEntity, values);
                loading();
                var dataValue = {};
                for (var item in theEntity){
                    if(theEntity[item]!=null)
                    theEntity[item] = theEntity[item].toString();
                }
                dataValue['theData'] = theEntity;
                
                $.postJSON('/Quartz/base_schedulesinfo/MainSaveData', dataValue, function (resJson) {
                    loading(false);

                    if (resJson.Success) {
                        parent.$('#dataTable').bootstrapTable('refresh');
                        parent.dialogSuccess();
                        
                        dialogClose();
                    }
                    else {
                        dialogError(resJson.Msg);
                    }
                });
            }
        })
    }

    //提交表单
    function submitForm() {
        $('#submit').trigger('click');
    }
    //清除表单数据
    function clearForm() {
        
    }
     $(function () {
        $('#WorkerContractImg').html5Uploader({
            //imgs: theEntity[aImgId],
            asyncUpload: true,
            uploadUrl: '/Base_SysManage/Common/UploadFile',
            uploadLimit: 0,  //上传数量限制，0为不限
            sizeLimit: 5,    //大小限制，M
            type:'file' //file即可上传文件也可上传图片
        });
    });

    
    //手写文字识别
    function OCRForm() {
        //获取上传后的url
        var url = $('#WorkerContractImg').html5Uploader('getUploadFiles');
        //console.log(url);   
        // 返回 web 主机的域名，如：http://127.0.0.1:8080/testdemo/test.html?id=1&name=test
        var href = window.location.href; 
        // 返回当前页面的路径和文件名，如：/testdemo/test.html
        var pathname = window.location.pathname;
        pathname = href.replace(pathname, "");
        // 获取参数，如：?id=1&name=test
        var search = window.location.search;
        pathname = pathname.replace(search, "") + " / ";


        url = (String(url)).replace(pathname, "");
            url = url.replace(/\//g, "\\");


            loading();
        $.postJSON('/Visit/visit_type_authorize/OCRData', { FileName: (url) }, function (resJson) {
                //loading(false);
                if (resJson.Success) {
                   $table.bootstrapTable('refresh');
                    dialogSuccess('表单识别成功!');
                }
                else {
                    dialogError(resJson.Msg);
                }
            });       
    }
    //语音识别输入
    function speech() {
    alert('功能完善中');
    }
 
    function openFormSelect(modelurl,returnkey,obj) {
        dialogOpen({
            id: 'form1',
            title: '@TranslateService.GetTranslate("","System_Select","选择")',
            btn: ['@TranslateService.GetTranslate("","System_Confirm","确定")', '@TranslateService.GetTranslate("","System_Cancel","取消")'],
            height: '80%',
            url: modelurl + '/GetIndex?returnkey=' + returnkey,
            yes: function(window, index) {
                 $(obj).val(window.chekcName);
                 $(obj).next().val(window.chekcCode).trigger("propertychange");
                 dialogClose("form1");
            }
        });
    }
</script>
